package com.weimei.conversionTreasure.viewModel;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.weimei.conversionTreasure.activity.MonthDetailActivity;
import com.weimei.conversionTreasure.http.entity.MonthBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class TotalMItemVM extends ItemViewModel {
    public ObservableField< MonthBean.DataDTO.ClistDTO> entity = new ObservableField<>();
    public ObservableField<String> time = new ObservableField<>("");
    public ObservableField<String> type = new ObservableField<>("");


    public TotalMItemVM(@NonNull BaseViewModel viewModel, MonthBean.DataDTO.ClistDTO data) {
        super(viewModel);
        entity.set(data);
    }

    public BindingCommand itemClick = new BindingCommand(() -> {
        Bundle bundle = new Bundle();
        bundle.putString("className",entity.get().getClassName());
        bundle.putString("time",time.get());
        bundle.putString("type",type.get());
        viewModel.startActivity(MonthDetailActivity.class,bundle);
    });

    public void setTime(String types,String times) {
        time.set(times);
        type.set(types);
    }
}
